<template>
  <div>
    <div class="placeholder">
      <div style="margin-right: 20px">
        当前绑定上级：{{ ruleList[0].afterChangeName }}
      </div>
      <div>ID：{{ ruleList[0].afterChangeId }}</div>
    </div>
    <el-table v-loading="loading" :data="ruleList">
      <el-table-column label="变更前绑定" prop="sysUserid">
        <template
          slot-scope="{ row }"
          v-if="row.beforeChangeName && row.beforeChangeId"
        >
          <div class="table-content">{{ row.beforeChangeName }}</div>
          <div class="table-content">会员ID：{{ row.beforeChangeId }}</div>
        </template>
      </el-table-column>
      <el-table-column label="变更后绑定" prop="sysUserid">
        <template slot-scope="{ row }">
          <div class="table-content">{{ row.afterChangeName }}</div>
          <div class="table-content">会员ID：{{ row.afterChangeId }}</div>
        </template>
      </el-table-column>
      <el-table-column label="变更时间" prop="changeTime" />
    </el-table>
    <pagination
      v-show="total > 0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />
  </div>
</template>

<script>
import {
  changeList,
  changeListPages,
  listLog,
} from "@/api/system/member/memberDetail";
import { forrmatterEnmu } from "@/utils/index";

export default {
  name: "ModifiedRecordOpen",
  props: ["userId"],
  data() {
    return {
      // 遮罩层
      loading: false,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 用户会员表格数据
      ruleList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        userId: null,
      },
    };
  },
  created() {
    this.getList();
  },
  methods: {
    forrmatterEnmu,
    /** 查询用户会员列表 */
    getList() {
      this.queryParams.userId = this.userId;
      this.loading = true;
      changeListPages(this.queryParams).then((response) => {
        this.ruleList = response.rows;
        this.loading = false;
      });
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
  },
};
</script>
<style lang="less" scoped>
.placeholder {
  display: flex;
  opacity: 0.6;
  margin-bottom: 20px;
}

.table-content {
  font-size: 13px;
}
</style>
